<?php

namespace App\Service\Third;

use App\Model\OcpcKshou;
use App\Service\BaseService;

class KshouAdService extends BaseService
{
    //https://.xx.com/callback/kshou_ad?
    //channel=1013&oaidMD5=__OAID2__&imeiMD5=__IMEI2__&callback=__CALLBACK__&campaignid=__DID__
    public function handle()
    {
        $params = $this->request->all();

        log_info('百度搜索广告监测链接===='.json_encode($params));

        if (OcpcKshou::existImeiMd5($params['imeiMD5'] ?? '')) {
            return 1;
        }

        if (OcpcKshou::existOaidMd5($params['oaidMD5'] ?? '')) {
            return 1;
        }

        return OcpcKshou::addLog($params);
    }
}